package 综合练习题;

import java.util.Set;

//UserGraphApp 类是程序的入口，用于测试 UserGraph 类的功能
public class UserGraphApp {
 public static void main(String[] args) {
     // 创建用户对象
     User user1 = new User(1, "Alice");
     User user2 = new User(2, "Bob");
     User user3 = new User(3, "Charlie");
     User user4 = new User(4, "David");

     // 创建用户关系图对象
     UserGraph userGraph = new UserGraph();
     // 添加好友关系
     userGraph.addFriendship(user1, user2);
     userGraph.addFriendship(user1, user3);
     userGraph.addFriendship(user2, user3);
     userGraph.addFriendship(user2, user4);

     // 查找两个用户的共同好友
     Set<User> commonFriends = userGraph.findCommonFriends(user1, user2);
     System.out.println("用户 " + user1.getName() + " 和 " + user2.getName() + " 的共同好友：" + commonFriends);

     // 为指定用户推荐可能认识的人
     Set<User> recommendedFriends = userGraph.recommendFriends(user1);
     System.out.println("用户 " + user1.getName() + " 可能认识的人：" + recommendedFriends);
 }
}
